// app.js
App({
  onLaunch(e) {
    let _this =this
    wx.hideTabBar(); //隐藏系统tabbar
    _this.getSystemInfo();
    // 展示本地存储能力
  },
  onHide (e) {
    // Do something when hide.




  },
 // 方法名：setSystemInfo
  // 方法作用：获取设备信息
  // 参数说明：
  getSystemInfo() {
    let that = this //复制this
    wx.getSystemInfo({ //微信小程序获取系统信息api
      success: function (res) {
        that.globalData.systemInfo = res; //将设备信息存入全局用于长屏812px以上的适配
      }
    });
  },
    // ===============================================
  // 自定义选项卡
  // 方法作用：
  editTabbar: function () {
    let tabbar = this.globalData.tabBar; //全局tarbar样式
    let currentPages = getCurrentPages(); //
    let _this = currentPages[currentPages.length - 1];
    let pagePath = _this.route; //当前页面的url
    (pagePath.indexOf('/') != 0) && (pagePath = '/' + pagePath);
    for (let i in tabbar.list) {
      tabbar.list[i].selected = false;
      (tabbar.list[i].pagePath == pagePath) && (tabbar.list[i].selected = true);
    }
    _this.setData({
      tabbar: tabbar
    });
  },
  globalData: {
    userInfo: null,
    systemInfo: null, //客户端设备信息
    tabBar: {
      "backgroundColor": "#243b7e",
      "color": "#ffffff",
      "selectedColor": "#ffffff",
      "list": [
        {
          "pagePath": "/pages/index/index",
          "text": "首页",
          "iconPath": "./icon/icon_home.png",
          "selectedIconPath": "./icon/icon_home_HL.png"
        },
        {
          "pagePath": "/pages/orderInfo/orderInfo",
          "text": "订单",
          "iconPath": "./icon/icon_release.png",
          "selectedIconPath": "./icon/icon_release_HL.png"
        },
        {
          "pagePath": "/pages/me/me",
          "text": "我的",
          "iconPath": "./icon/icon_mine.png",
          "selectedIconPath": "./icon/icon_mine_HL.png"
        }
      ]
    }
  }
})
